﻿// ReSharper disable CheckNamespace
namespace System.Collections.Generic
{
    public static class EnumerableExtensions
    {
        /// <summary>
        /// Performs the specified action on each item in the enumerable collection.
        /// </summary>
        /// <typeparam name="T">Type of objects stored in the enumerable collection.</typeparam>
        /// <param name="enumerable">The enumerable collection to iterate over.</param>
        /// <param name="action">The action to perform on each item in the collection.</param>
        public static void Each<T>(this IEnumerable<T> enumerable, Action<T> action)
        {
            if (action == null) throw new ArgumentNullException("action");

            foreach (var t in enumerable)
                action.Invoke(t);
        }
    }
}
// ReSharper restore CheckNamespace